{template 'web/_header'}
{template 'web/shop/tabs'}

{if $operation == 'display'}
<div class="main panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:30px;">ID</th>
                    <th style="width:80px;">显示顺序</th>
                    <th style="width:200px;">物流名称</th>
                    <th style="width:300px;">区域说明</th>
                    <th style="width:120px;">操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $item}
                <tr>
                    <td>{$item['id']}</td>
                    <td>{$item['displayorder']}</td>
                    <td>{$item['express_name']}</td>
                    <td>{$item['express_area']}</td>
                    <td style="text-align:left;">
                        <a href="{php echo $this->createWebUrl('shop/express', array('op' => 'post', 'id' => $item['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="修改"><i class="fa fa-pencil"></i></a>
                        <a href="{php echo $this->createWebUrl('shop/express', array('op' => 'delete', 'id' => $item['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times"></i></a>
                    </td>
                </tr>
                {/loop}
                <tr>
                    <td colspan='5'>
                        <a class='btn btn-default' href="{php echo $this->createWebUrl('shop/express',array('op'=>'post'))}"><i class='fa fa-plus'></i> 添加物流</a>
                    </td>
                </tr>
            </tbody>
        </table>

        {$pager}
    </div>
</div>
<script>
    require(['bootstrap'], function($){
    $('.btn').hover(function(){
    $(this).tooltip('show');
    }, function(){
    $(this).tooltip('hide');
    });
    });</script>
{elseif $operation == 'post'}

<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
        <input type="hidden" name="id" value="{$express['id']}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                物流详细设置
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="displayorder" class="form-control" value="{$express['displayorder']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">常用快递公司</label>
                    <div class="col-sm-9 col-xs-12">
                        <select id="common_corp" class="form-control input-medium">
                            <option value="">其他快递</option>
                            <option value="shunfeng">顺丰</option>
                            <option value="shentong">申通</option>
                            <option value="yunda">韵达快运</option>
                            <option value="tiantian">天天快递</option>
                            <option value="yuantong">圆通速递</option>
                            <option value="zhongtong">中通速递</option>
                            <option value="ems">ems快递</option>
                            <option value="huitongkuaidi">汇通快运</option>
                            <option value="quanfengkuaidi">全峰快递</option>
                            <option value="zhaijisong">宅急送</option>
                            <option value="aae">aae全球专递</option>
                            <option value="anjie">安捷快递</option>
                            <option value="anxindakuaixi">安信达快递</option>
                            <option value="biaojikuaidi">彪记快递</option>
                            <option value="bht">bht</option>
                            <option value="baifudongfang">百福东方国际物流</option>
                            <option value="coe">中国东方（COE）</option>
                            <option value="changyuwuliu">长宇物流</option>
                            <option value="datianwuliu">大田物流</option>
                            <option value="debangwuliu">德邦物流</option>
                            <option value="dhl">dhl</option>
                            <option value="dpex">dpex</option>
                            <option value="dsukuaidi">d速快递</option>
                            <option value="disifang">递四方</option>
                            <option value="fedex">fedex（国外）</option>
                            <option value="feikangda">飞康达物流</option>
                            <option value="fenghuangkuaidi">凤凰快递</option>
                            <option value="feikuaida">飞快达</option>
                            <option value="guotongkuaidi">国通快递</option>
                            <option value="ganzhongnengda">港中能达物流</option>
                            <option value="guangdongyouzhengwuliu">广东邮政物流</option>
                            <option value="gongsuda">共速达</option>
                            <option value="hengluwuliu">恒路物流</option>
                            <option value="huaxialongwuliu">华夏龙物流</option>
                            <option value="haihongwangsong">海红</option>
                            <option value="haiwaihuanqiu">海外环球</option>
                            <option value="jiayiwuliu">佳怡物流</option>
                            <option value="jinguangsudikuaijian">京广速递</option>
                            <option value="jixianda">急先达</option>
                            <option value="jjwl">佳吉物流</option>
                            <option value="jymwl">加运美物流</option>
                            <option value="jindawuliu">金大物流</option>
                            <option value="jialidatong">嘉里大通</option>
                            <option value="jykd">晋越快递</option>
                            <option value="kuaijiesudi">快捷速递</option>
                            <option value="lianb">联邦快递（国内）</option>
                            <option value="lianhaowuliu">联昊通物流</option>
                            <option value="longbanwuliu">龙邦物流</option>
                            <option value="lijisong">立即送</option>
                            <option value="lejiedi">乐捷递</option>
                            <option value="minghangkuaidi">民航快递</option>
                            <option value="meiguokuaidi">美国快递</option>
                            <option value="menduimen">门对门</option>
                            <option value="ocs">OCS</option>
                            <option value="peisihuoyunkuaidi">配思货运</option>
                            <option value="quanchenkuaidi">全晨快递</option>
                            <option value="quanjitong">全际通物流</option>
                            <option value="quanritongkuaidi">全日通快递</option>
                            <option value="quanyikuaidi">全一快递</option>
                            <option value="rufengda">如风达</option>
                            <option value="santaisudi">三态速递</option>
                            <option value="shenghuiwuliu">盛辉物流</option>
                            <option value="sue">速尔物流</option>
                            <option value="shengfeng">盛丰物流</option>
                            <option value="saiaodi">赛澳递</option>
                            <option value="tiandihuayu">天地华宇</option>
                            <option value="tnt">tnt</option>
                            <option value="ups">ups</option>
                            <option value="wanjiawuliu">万家物流</option>
                            <option value="wenjiesudi">文捷航空速递</option>
                            <option value="wuyuan">伍圆</option>
                            <option value="wxwl">万象物流</option>
                            <option value="xinbangwuliu">新邦物流</option>
                            <option value="xinfengwuliu">信丰物流</option>
                            <option value="yafengsudi">亚风速递</option>
                            <option value="yibangwuliu">一邦速递</option>
                            <option value="youshuwuliu">优速物流</option>
                            <option value="youzhengguonei">邮政包裹挂号信</option>
                            <option value="youzhengguoji">邮政国际包裹挂号信</option>
                            <option value="yuanchengwuliu">远成物流</option>
                            <option value="yuanweifeng">源伟丰快递</option>
                            <option value="yuanzhijiecheng">元智捷诚快递</option>
                            <option value="yuntongkuaidi">运通快递</option>
                            <option value="yuefengwuliu">越丰物流</option>
                            <option value="yad">源安达</option>
                            <option value="yinjiesudi">银捷速递</option>
                            <option value="zhongtiekuaiyun">中铁快运</option>
                            <option value="zhongyouwuliu">中邮物流</option>
                            <option value="zhongxinda">忠信达</option>
                            <option value="zhimakaimen">芝麻开门</option>
                        </select>
                        <span class="help-block">如果您选择了常用快递，则客户可以订单中查询快递信息，如果缺少您想要的快递，您可以联系我们! </span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>物流公司</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" id='express_name' name="express_name" class="form-control" value="{$express['express_name']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">公司网站</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="express_url" class="form-control" value="{$express['express_url']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">配送区域</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="express_area" class="form-control" value="{$express['express_area']}" />
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" onclick='return formcheck()' />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
<script language='javascript'>
            function formcheck(){
            if ($("#express_name").isEmpty()){
            Tip.focus("express_name", "请填写物流公司名称!");
                    return false;
            }
            return true;
            }

    $(function(){
    $("#common_corp").change(function(){
    var obj = $(this);
            var sel = obj.find("option:selected");
            $("#express_name").val(sel.attr("data-name"));
            $("#express_url").val(sel.val());
    });
    {if !empty($express['id'])}
    $("#common_corp").val("{$express['express_url']}");
    {/if}

    })
</script>
{/if}
{template 'common/footer'}